package com.study.flink.datastream.partition;

import org.apache.flink.api.common.functions.Partitioner;

/**
 * @author stephen
 * @create 2019-01-26 21:11
 * @since 1.0.0
 */
public class MyPartition implements Partitioner<Long> {
    @Override
    public int partition(Long key, int numPartitions) {
        System.out.println("总分区数："+numPartitions);
        if(key%2==0){
            return 0;
        }
        return 1;
    }
}
